Skip to content

fix(deploy): a role's source path no longer depends on the playbook's folder (#20509) - #20515

Merged
mrveiss merged 5 commits into
mainfrom
issue-20510-role-source
Nov 2, 2026
Merged

mrveiss merged 5 commits into
mainfrom
issue-20510-role-source

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

The Full-Tree Drift Check caught autobot-ai-stack/ai_api_server.py 31 lines off source. The role copied from {{ playbook_dir }}/../../../..., and playbook_dir depends on the playbook's folder: from ansible/playbooks/ that reaches the repo root, and from ansible/ it reaches one level above. So a role deploy read a stale sibling tree and put months-old code on the host. Evidence is on #20509.

What Changed

  • All 10 uses under roles/ now use {{ role_path }}/../../../../, whose depth is fixed. In _shared tasks, also included from update-all-nodes.yml where no role is active, it falls back to playbook_dir at the known depth.
  • New guard: no role climbs out of playbook_dir, in the {{ }} or ~ spelling, with contrasts and a declared reach.
  • backend_services's "Copy AutoBot application files" now always copies ansible/, what it copied from playbooks/. From ansible/ it used to copy all of autobot-slm-backend. What that task is for was not established; I kept the behaviour of the path deploy-full.yml uses.
  • The two playbooks still using the pattern, data-migration.yml and enroll-node.yml, plus update-all-nodes.yml, live in playbooks/, where the depth is right. Left as they are.

Verification

role_source_paths_depth_proof_20509_test.py and the reach guards pass locally; only these. A real ansible-playbook on a throwaway tree, from both ansible/ and ansible/playbooks/, resolved role and _shared paths to the repo root each time. Not run on a host, so this says Refs.

Worth reviewing:

  • _shared/tasks/install_agent_autobot_shared.yml climbs with dirname three times from playbook_dir. Its callers are all in playbooks/, so it is right today; the guard does not read that spelling.
  • playbook_executor.py's fallback to the deployed ansible dir still resolves to the stale tree; filed as decision(deploy): the playbook executor's fallback can run roles against a stale tree #20520, with options.
  • This does not repair the host. The next builtin update that reaches the aiml group should, from its own archive; that is the third criterion.
  • A _shared task included by a playbook at ansible/ root with no active role would still be one level off. The current callers are roles and update-all-nodes.yml.

Model Used

Claude Opus 5.5

Refs #20509

🤖 Generated with Claude Code

@mrveiss mrveiss added the phase:M1.4 Wizard and SLM: choose a mode, apply it, default models work label Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 09e1c80 and 5fbc150.

Files selected for processing: 13
  • autobot-slm-backend/ansible/roles/_shared/tasks/clear_venv_husks.yml
  • autobot-slm-backend/ansible/roles/_shared/tasks/stage_shared_manifests.yml
  • autobot-slm-backend/ansible/roles/ai-stack/tasks/main.yml
  • autobot-slm-backend/ansible/roles/backend_services/tasks/main.yml
  • autobot-slm-backend/ansible/roles/monitoring/tasks/grafana.yml
  • autobot-slm-backend/ansible/roles/slm_agent/tasks/main.yml
  • autobot-slm-backend/ansible/roles/slm_manager/tasks/grafana.yml
  • autobot-slm-backend/ansible/roles/slm_manager/tasks/main.yml
  • autobot-slm-backend/ansible/roles/tts-worker/tasks/main.yml
  • repo_tests/_reach_policy_verdicts.py
  • repo_tests/_reach_roots_record.py
  • repo_tests/reach_scope_claim_17844_test.py
  • repo_tests/role_source_paths_depth_proof_20509_test.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20515 (head 4327b23): changes needed.

The 8 role_path replacements climb to the repo root correctly. Two uses of the same defect remain under roles/, and the guard can't see them:

  • roles/tts-worker/tasks/main.yml:241: playbook_dir ~ '/../../../autobot-tts-worker/requirements.txt'. Use role_path ~ '/../../../../autobot-tts-worker/requirements.txt'.
  • roles/slm_agent/tasks/main.yml:97: chdir: "{{ playbook_dir }}/../../.." for git rev-parse HEAD, which records the wrong commit or fails from an ansible/ playbook. Use {{ role_path }}/../../../...
  • repo_tests/role_source_paths_depth_proof_20509_test.py:15 matches only the literal playbook_dir }}/../../../. Match any playbook_dir followed by .. in role YAML, with contrast cases for both forms above.
  • roles/backend_services/tasks/main.yml:82: synchronize src: "{{ playbook_dir }}/../" also depends on playbook depth. Decide what it should sync, then fix it or list it as intended.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20515 (head bda4c67): approve.

The three remaining sites now climb the right depth from role_path: tts-worker and slm_agent to the repo root, and backend_services to ansible/, the same directory deploy-full.yml gave it. No playbook_dir climb remains under roles/ except the default(playbook_dir ~ '/x') fallbacks, which are right for their two playbook callers. The guard's pattern matches both spellings, with contrast cases. Read only; I didn't run the tests. What the backend_services copy is for remains open, as the body says.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Auto-sync: merging main into issue-20510-role-source conflicts

The sync aborted the merge and pushed nothing. Conflicts are information, so it never resolves one itself. Below, for each conflicted file, are the commits that touched it on each side since the merge base 64943e39e5. Merge main in yourself and push; the label clears on the first run that finds this branch 0 behind.

repo_tests/_reach_policy_verdicts.py

side commit subject issue refs
main 63bfb6599 fix(guard): the playbook reference guard declares its reach (#19611) #19611
main 4e9c146eb Merge main into issue-19611-playbook-refs (auto-sync) [skip ci] none
main da8d28608 guard(docs): the playbook guard reads role tables and the registry, and counts references (#19611) #19611
main cd1d91bcd guard(docs): the playbook reference guard is registered, and the guide uses a placeholder (#19611) #19611
this branch 4327b239f fix(deploy): a role's source path no longer depends on the playbook's folder (#20509) #20509

repo_tests/reach_scope_claim_17844_test.py

side commit subject issue refs
main 8a3558ef3 fix(guard): the reference sweep survives an empty tree and claims the trees it finds (#19611) #19611
main 63bfb6599 fix(guard): the playbook reference guard declares its reach (#19611) #19611
main 4e9c146eb Merge main into issue-19611-playbook-refs (auto-sync) [skip ci] none
main da8d28608 guard(docs): the playbook guard reads role tables and the registry, and counts references (#19611) #19611
main cd1d91bcd guard(docs): the playbook reference guard is registered, and the guide uses a placeholder (#19611) #19611
this branch 4327b239f fix(deploy): a role's source path no longer depends on the playbook's folder (#20509) #20509

@github-actions github-actions Bot removed the sync-conflict Set by the branch sync (#19548) label Nov 1, 2026
@mrveiss
mrveiss merged commit 889d3a6 into main Nov 2, 2026
5 checks passed
@mrveiss
mrveiss deleted the issue-20510-role-source branch November 2, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase:M1.4 Wizard and SLM: choose a mode, apply it, default models work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant